<?php
/**
 * Author: Administrator
 * Date: 2022/8/3 2:04
 */

namespace DesignPatterns\Behavioral\Strategy;

class DateComparator implements ComparatorInterface
{

    public function compare($a, $b): int
    {
        $a = new \DateTime($a['date']);
        $b = new \DateTime($b['date']);
        return $a==$b ? 0 : ($a > $b ? 1 : -1);
    }
}